# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=sea
pkgver=103.9aca1c8
pkgrel=4
groups=('blackarch' 'blackarch-malware' 'blackarch-binary')
pkgdesc='A tool to help to create exploits of binary programs.'
arch=('any')
url='https://github.com/neuromancer/SEA'
license=('GPL3')
depends=('python2' 'python2-z3' 'z3')
makedepends=('git')
source=("$pkgname::git+https://github.com/neuromancer/SEA.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"

  rm COPYING README.md

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 SEA.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

